import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/layout'
import Home from '../views/home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect:'/home',
    children:[
      {
        path: 'home',
        name: 'Home',
        component: Home,
      },
      {
        path: 'detail',
        name: 'Detail',
        component:()=>import('../views/detail')
      },
      {
        path: 'control',
        name: 'Control',
        component:()=>import('../views/control')
      },
      {
        path: 'operation',
        name: 'Operation',
        component:()=>import('../views/operation')
      },
      {
        path: 'data',
        name: 'Data',
        component:()=>import('../views/data')
      },
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
